import request from '@/utils/request';
import { AxiosPromise } from 'axios';

/**
 * @description 点赞or取消点赞帖子
 * @param query {
    "type": "like Or unlike",
    "authorId": "文章用户的id"
    "postsId": "文章id"
}
 * @returns 
 */
export const likePosts = (query?: any,headers?:any): AxiosPromise<any> => {
    return request({
      url: '/api/like/posts',
      method: 'post',
      data: query,
      headers:headers
    });
};

/**
 * @description 点赞or取消点赞评论
 * @param query {
    "type": "like",unlike
    "commentId": 1
}
 * @returns 
 */
export const likeComment = (query?: any,headers?:any): AxiosPromise<any> => {
    return request({
      url: '/api/like/comment',
      method: 'post',
      data: query,
      headers:headers
    });
};